{include file="common/_meta" /}
<title></title>
</head>

<body>
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 商品分类 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">
        <!-- <div class="text-c">
		<form class="Huiform" method="get" action="" target="_self">
			<input type="text" placeholder="分类名称" name="pd_name" class="input-text" style="width:200px">
			<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe709;</i> 搜索</button>
		</form>

	</div> -->
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <!-- <a class="btn btn-primary radius" onclick="cateAdd()" href="javascript:;"><i class="Hui-iconfont"></i> 添加分类</a> -->
            <!-- <span class="r">共有数据：<strong></strong> 条</span> </div> -->
            <div class="mt-20">
                <table class="table table-border  table-hover table-bg table-sort">
                    <thead>
                        <tr class="text-c">
                            <th width="25">
                                <input type="checkbox" name="" value="">
                            </th>
                            <th>ID</th>
                            <th>排序</th>
                            <th>分类图标</th>
                            <th class="text-l">分类名称</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name="levelOne" id="vo"}
                        <tr class="text-c">
                            <td>
                                <input name="" type="checkbox" value="">
                            </td>
                            <td>{$i}</td>
                            <td>{$vo.level}</td>
                            <td><img  style="width: 40px;height: 40px" class="product-thumb image" src="{$vo.cate_pic}" alt=""></td>
                            <td class="text-l">{$vo.cate_name}</td>
                            <td class="f-14 product-brand-manage">
                                <a style="text-decoration:none" onClick="cate_edit({$vo.id})" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>
                            </td>
                        </tr>
                        {/volist}
                    </tbody>
                </table>
            </div>
            <div class="pages" style="margin:20px;float: right; "></div>
            <!--添加、修改分类-->
            <div id="cate_add" class="modal fade" style="margin: 0 auto;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content radius">
                        <div class="modal-header">
                            <h3 class="modal-title"></h3>
                            <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                        </div>
                        <div class="modal-body">
                            <article class="page-container" style="padding-right: 10%;">
                                <form action="{:url('Mall/cate')}" method="post" class="form form-horizontal" id="form-cate-add" enctype="multipart/form-data">
                                    <div class="row cl hidden">
                                        <label class="form-label col-xs-4 col-sm-3"></label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <input type="text" name="id" class="input-text" placeholder="" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="row cl hidden">
                                        <label class="form-label col-xs-4 col-sm-3">上级分类</label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <span class="select-box">
											  <select class="select" size="1" name="pid">
											    <option value="0" >一级分类</option>
											    {volist name="levelOne" id="vo"}
											    	<option value="{$vo.id}" >{$vo.cate_name}</option>
											    {/volist}
											  </select>
											</span>
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-4 col-sm-3">分类名称：</label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <input type="text" name="cate_name" class="input-text" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-4 col-sm-3">分类图标：</label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <input type="file" name="cate_pic" class="input-text" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <label class="form-label col-xs-4 col-sm-3">排序：</label>
                                        <div class="formControls col-xs-8 col-sm-9">
                                            <input type="text" name="level" class="input-text" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="row cl">
                                        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                                            <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                                        </div>
                                    </div>
                                </form>
                            </article>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {include file="common/_footer" /}
        <script type="text/javascript">
        function cate_edit(id) {
            if (id) {
                $.get('{:url("Mall/cate")}?id=' + id).success(function(data) {
                    if (data) {
                        $('#cate_add select[name="pid"]').val(data.pid);
                        $('#cate_add input[name="id"]').val(data.id);
                        $('#cate_add input[name="cate_name"]').val(data.cate_name);
                        $('#cate_add input[name="level"]').val(data.level);
                    }
                });
            }
            $("#cate_add").modal("show")
        }

        function cateAdd() {
            $('#cate_add input[name="id"]').val();
            $('#cate_add input[name="cate_name"]').val('');
            $('#cate_add input[name="level"]').val(0);
            $("#cate_add").modal("show");
        }

        // $("#form-cate-add").find('input:submit').click(function() {
        //     $.post("{:url('Mall/cate')}", $("#form-cate-add").serialize()).success(function(data) {
        //         layer.msg(data.msg);
        //         if (data.code) {
        //             setTimeout(function() {
        //                 history.go(0);
        //             }, 1000);
        //         }
        //     });
        //     return false;
        // });
        </script>
</body>

</html>